<template>
    <div>

             <el-carousel indicator-position="outside">
    <el-carousel-item v-for="item in imgarray" :key="item">
      <img :src="item.imgUrl" style="width:100%;height:inherit">
    </el-carousel-item>
  </el-carousel>
         <el-row>
  <el-button>默认按钮</el-button>
  <el-button type="primary">主要按钮</el-button>
  <el-button type="success">成功按钮</el-button>
  <el-button type="info">信息按钮</el-button>
  <el-button type="warning">警告按钮</el-button>
  <el-button type="danger">危险按钮</el-button>
</el-row>
<span>用户名:</span><el-input v-model="username" placeholder="请输入用户名"></el-input>
<span>密码:</span><el-input placeholder="请输入密码" v-model="password" show-password></el-input>
  <el-button type="primary" style="margin-left:150px" @click="login">登录</el-button>
    </div>
</template>

<script>
import { userlogin } from '../api/data.js'
    export default{

        name:'page1',
        data(){
            return{
             username:'',
             password:'',
            imgarray:[{name:'1',imgUrl:require('../assets/img/1.jpeg')},{name:'2',imgUrl:require('../assets/img/2.jpeg')},{name:'3',imgUrl:require('../assets/img/3.jpeg')}]
            }
        },
        methods:{
            login(){
                console.log("用户名",this.username)
                console.log("密码",this.password)
                userlogin({username:this.username,password:this.password}).then(res=>{
                    console.log("接口返回数据",res)
                    if(res.data=="登录成功"){
                        this.$router.push('/page2')
                    }
                    else{
                        this.$message.console.error(('您的用户名或密码输入错误'));
                    }
                })
            }
                // if(this.admin!="李鸣宇")
                // {
                //             this.$message.error('您的用户名输入错误');
                // }
                // else if(this.password!="123456"){
                //             this.$message.error('您的密码输入错误');
                // }
                // else{
                //     this.$router.push('/page2')
                // }
            
        }
    }
</script>

<style>

</style>